<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        canvas {
            border: 1px solid red;
        }
    </style>
</head>
<body>
    <canvas id="mycanvas" height="150" width="150">
        <!-- 我的canvas -->
        <!-- 这上面是替换内容，所以不会显示 -->
    </canvas>
    <script type="text/javascript">
        const mycanvas = document.querySeletor("#mycanvas");
        if (mycanvas.getContext) {
            // 支持canv
            const ctx = mycanvas.getContext("2d");
        } else {
            // 不支持canvas
        }
    </script>
</body>
</html>